#ifndef ATTENDENCEWIN_H
#define ATTENDENCEWIN_H

#include <QMainWindow>
#include <QTcpSocket>
#include <QTcpServer>
#include "qfaceobject.h"
#include <opencv2/opencv.hpp>
#include <QDataStream>

QT_BEGIN_NAMESPACE
namespace Ui
{
    class attendenceWin;
}
QT_END_NAMESPACE

class attendenceWin : public QMainWindow
{
    Q_OBJECT

public:
    attendenceWin(QWidget *parent = nullptr);
    ~attendenceWin();

signals:
    void query(cv::Mat image);

private slots:
    void newConnection();
    void read_data();
    void sendEmployeeDataToClient(int employeeID); // 接收员工ID并处理考勤

private:
    void processCompleteImage(const QByteArray &imageData); // 添加函数声明
    void processFaceRecognition(int faceId);                // 处理人脸识别结果
    bool checkAttendanceRecord(int employeeID);             // 查询当天考勤记录
    bool insertAttendanceRecord(int employeeID);            // 插入新的考勤记录

    quint64 bsize;
    QByteArray imageData;
    Ui::attendenceWin *ui;
    QTcpServer *serverSocket;
    QTcpSocket *tcpSocket;
    QFaceObject *faceObject;
    bool attendanceRecorded; // 标记当前会话是否已记录考勤
    QThread *thread;
};
#endif // ATTENDENCEWIN_H
